package com.mark.maven.service.order.query.impl;

import com.mark.maven.dao.QueryOrderDao;
import com.mark.maven.domain.Order;
import com.mark.maven.service.order.query.QueryOrderService;
import com.mark.maven.service.order.query.req.QueryOrderRequest;
import com.mark.maven.service.order.query.resp.QueryOrderResponse;
import org.springframework.stereotype.Service;

@Service
public class QueryOrderServiceImpl implements QueryOrderService {

    private final QueryOrderDao queryOrderDao;

    public QueryOrderServiceImpl(QueryOrderDao queryOrderDao) {
        this.queryOrderDao = queryOrderDao;
    }

    @Override
    public QueryOrderResponse<Order> queryOrder(QueryOrderRequest request) {
        Order order = queryOrderDao.queryByNo(request.getOrderNo());
        return QueryOrderResponse.ofSuccess(order);
    }
}
